MStencilPtr is a useful function in its own right but has been included in the c2p section of the manual because it is of particular use for providing the `Chunky' parameter of Mc2p. Using MStencilPtr you can return an address that has been calculated based on the stencil of one of Mildred's Bitmap objects.
At its simplest, the routine will take the base address of the Bitmap's stencil data. It will check if `wrapping' is active (see the relevent section of the manual) and if so will add the Bitmap's Origin coordinate position to the base address. Then it will check if `clipping' is active (see the relevent section of the manual), and if so it will add the Bitmap's clip window top-left corner coordinate position to the base address. This final address will then be returned and can be used mainly as the Chunky.l address required by Mc2p.
In its more sophisticated form, the routine can also take additional Xoffset and Yoffset coordinates, produce an address offset from them and add this also to the base address. Using this on its own you can position the topleft corner of the chunky source data. It's greater use comes when you have a map-tile type display where you need to draw stencil-tiles to the nearest 16 or 32 pixels, for example, by using the Bitmap's Origin `wrapping' (see the relevent section of the manual). It would be inefficient to specify an aligned origin for the drawing of tiles and then an unaligned origin for the c2p conversion, so Xoffset and Yoffset can be used to provide values between 0-15, or 0-31 for example, to allow finetuning of the scroll position. Using MStencilPtr will allow you to view a Bitmap's usually unviewable stencil.
If you do not specify a chunky Bitmap object to use, the routine will assume the currently used Bitmap object and base its calculations on that object's stencil instead.
Possible syntax:
MStencilPtr ( BitmapNum.w )